package com.yuyu.service.impl;

import com.yuyu.bean.Employee;
import com.yuyu.exception.EmployeeException.EmployeeNotExsitException;
import com.yuyu.service.EmployeeService;
import com.yuyu.uitlbean.PageData;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


public class EmployeeServiceImplTest {
    ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
    EmployeeService employeeService = (EmployeeService) applicationContext.getBean("employeeService");


    @Test
    public void addEmployee() {
    }

    @Test
    public void deleteEmployee(){
        throw new EmployeeNotExsitException("不存在");
    }

    @Test
    public void editEmployee() {
        Employee employee = new Employee();
        employee.setUsername("chenhong");
        employee.setAddress("1");
        employeeService.editEmployee(employee);
    }

    @Test
    public void findEmployee() {
        PageData pageData1 = new PageData();
        pageData1.setPage_number(2);
        pageData1.setPage_limit(5);
        System.out.println(employeeService.filtrateEmployee(pageData1,"1"));
    }
}
